package com.xunwulian.base.util;

import java.util.Date;

/**
 * Created by Administrator on 2017/3/24.
 */
public class DateUtil2 {

    public static final long MILLIS_DAY = 24 * 60 * 60 * 1000L;

    public Date currentDay() {
        return new Date();
    }

    public Date preDay() {
        Date date = currentDay();
        long time = date.getTime();
        time -= MILLIS_DAY;
        return new Date(time);
    }

    public Date preDay(int num) {
        Date date = currentDay();
        long time = date.getTime();
        time -= num * MILLIS_DAY;
        return new Date(time);
    }

    public Date preDay(Date date) {
        long time = date.getTime();
        time -= MILLIS_DAY;
        return new Date(time);
    }

    public Date preDay(Date date, int num) {
        long time = date.getTime();
        time -= num * MILLIS_DAY;
        return new Date(time);
    }

    public Date nextDay() {
        Date date = currentDay();
        long time = date.getTime();
        time += MILLIS_DAY;
        return new Date(time);
    }

    public Date nextDay(int num) {
        Date date = currentDay();
        long time = date.getTime();
        time += num * MILLIS_DAY;
        return new Date(time);
    }

    public Date nextDay(Date date) {
        long time = date.getTime();
        time += MILLIS_DAY;
        return new Date(time);
    }

    public Date nextDay(Date date, int num) {
        long time = date.getTime();
        time += num * MILLIS_DAY;
        return new Date(time);
    }
}
